feathers-errors
![Build Status](https://travis-ci.org/feathersjs/feathers-errors.png?branch=master)
Common error types for feathers apps
Getting Started
Feathers errors come with feathers by default. So typically you don't need to install it at all.
In the event that you do need to install it:
npm install --save feathers-errors
Documentation
Current Error Types:
BadRequest
: 400NotAuthenticated
: 401PaymentError
: 402Forbidden
: 403NotFound
: 404MethodNotAllowed
: 405NotAcceptable
: 406Timeout
: 408Conflict
: 409Unprocessable
: 422GeneralError
: 500NotImplemented
: 501Unavailable
: 503
Pro Tip: Feathers service adapters (ie. mongodb, memory, etc.) already emit the appropriate errors for you. :-)
Usage:
import errors from 'feathers-errors';
var notFound = new errors.NotFound('User does not exist'));
var existing = new errors.GeneralError(new Error('I exist'));
var data = new errors.BadRequest('Invalid email', {email: 'sergey@google.com'});
var dataWithoutMessage = new errors.BadRequest({email: 'sergey@google.com'});
var validationErrors = new errors.BadRequest('Invalid Parameters', {errors: {email: 'Email already taken'} });
var validationErrors = new errors.BadRequest({errors: {email: 'Invalid Email'} });
Release History
1.2.0
- Adding error handler and basic static error pages back in
1.1.2
- Adding more tests
- Adding even more flexibility for handling multiple errors
1.1.1
1.1.0
- Adding better support for multiple errors
1.0.0
- converting to ES6
- making structure consistent with other plugins
- removing error handlers #11
0.2.0
- Adding support for mongoose errors Issue #5.
0.1.4
- Adding more error types
- Changing
missing
to fourOhFour
- Making library feathers core compatible
0.1.3
- Adding a default error page
0.1.2
0.1.1
- Exposing error types directly via
var types = require('feathers-errors').types;
0.1.0
License
Copyright (c) 2015 Feathers Contributors
Licensed under the MIT license.